<?php $this->load->view('backend/include/modal_header')?>

<?php if ($selector == selector_replace('.flip_sub_page')):?>
	<?php if ($operate == 'create'):?>
	<script>
	$(function() {
		var width = <?php echo $selector_data['detail']['width']?>;
		var height = <?php echo $selector_data['detail']['height']?>;

		<?php if ($sub_page_type == 'design'):?>
		var readme = '（上传图片名称格式：标题-年代）';
		<?php elseif ($sub_page_type == 'teach' || $sub_page_type == 'awards'):?>
		var readme = '（上传图片名称格式：标题-副标题）';
		<?php elseif ($sub_page_type == 'treatise'):?>
		var readme = '（上传图片名称格式：标题）';
		<?php endif;?>
		
		My_widget.upload.upload_widget({ width: width, height: height, readme: readme });
	});
    </script>
	<div class="modal-body">
	</div>
	<?php elseif ($operate == 'edit'):?>
	<script>
	$(document).ready(function() {
		var width = <?php echo $selector_data['detail']['width']?>;
		var height = <?php echo $selector_data['detail']['height']?>;
		My_widget.sortable.sortable_widget({
			trash: true,
			inject_param: 'content_weight',
			type: 'image',
			width: width,
			height: height
		});
	});
    </script>
	<div class="modal-body">
		<div class="sortable-widget">
			<div class="sortable">
				<ul>
					<?php foreach ($content as $v):?>
					<?php if (!empty($v['pic'])):?>
					<li id="<?php echo $v['id']?>">
						<b style="display:block; height:36px;"><?php echo $v['name']?></b>
						<img src="<?php echo $v['pic'][0]['thumb_path']?>">
						<i class="icon-move"></i>
					</li>
					<?php endif;?>
					<?php endforeach;?>
				</ul>
			</div>
			<div class="trash">
			<i class="icon-trash"></i> <b>垃圾箱</b>
			</div>
		</div>
	</div>
	<?php endif;?>
<?php elseif ($selector == selector_replace('.flip-block')):?>
	<?php if ($operate == 'edit'):?>
	<script>
	$(function() {
        editor = CKEDITOR.replace('content_textarea', { toolbar : 'MyToolbar', height: 265 });
        CKFinder.setupCKEditor(editor, '<?php echo PLUGIN_CKFINDER_FOLDER ?>');
	});
    </script>
	<div class="modal-body">
		<form>
		<input type="hidden" id="id" name="id" value="<?php echo $content['id']?>">
			<ul>
				<li>
					<label>标题</label>
					<input type="text" id="name" name="name" value="<?php echo $content['name']?>">
				</li>
				<?php if ($sub_page_type == 'design'):?>
				<li>
					<label>年代</label>
					<input type="text" id="year" name="year" value="<?php echo $content['year']?>">
				</li>
				<?php elseif ($sub_page_type == 'teach' || $sub_page_type == 'awards'):?>
				<li>
					<label>副标题</label>
					<input type="text" id="sub_title" name="sub_title" value="<?php echo $content['sub_title']?>">
				</li>
				<?php endif;?>
				<li>
					<label>内容</label>
					<textarea id="content_textarea"><?php echo $content['content']?></textarea>
				</li>
			</ul>
		</form>
	</div>
	<?php endif;?>
<?php endif;?>

<?php $this->load->view('backend/include/modal_footer')?>